import { Share_fail, Share_quit, Share_start, Share_success } from '../Type'

let share_info = {
    state: 'default',
    share: false,
    loading: false,
    data: {

    }
}

const share = (status = share_info, action) => {
    if (action.type === Share_start) {
        return {
            state: action.msg,
            share: false,
            loading: true
        }
    }
    if (action.type === Share_success) {
        return {
            state: action.msg,
            share: true,
            loading: true,
            data: action.data
        }
    }
    if (action.type === Share_fail) {
        return {
            state: action.msg,
            share: false,
            loading: false
        }
    }
    if (action.type === Share_quit) {
        return {
            status: action.msg,
            share: true,
            loading: false
        }
    }
    return status
}

export default share;